A dynamic run-time environment for a language such as JAVA™ is responsible for managing memory for objects that are created and destroyed during the execution of a program. An object is an entity that encapsulates data and, in some languages, operations associated with the object. Since the encapsulated data is stored in memory, objects are associated with particular regions of memory that are allocated and deallocated by the dynamic run-time environment. Many dynamic run-time environments create objects that last as long as the objects are being referenced by a program, and these objects are deallocated when they are no longer referenced through a procedure known as garbage collection.
In run-time environments that permit multiple users to connect in separate, concurrent sessions to a server system, scalability in terms of the number of simultaneous users who can establish separate sessions is very important. User scalability is primarily constrained by the size of the memory footprint that each session consumes. For example, a server system may have 100 Mb of memory for supporting all the user sessions. If the session memory footprint is 1 Mb, then only 100 users can be supported at one time; however, if the session memory requirements can be dropped to 500 Kb, a total of 200 user sessions can now be supported. Therefore, it is desirable to reduce the session memory footprint to improve scalability.
One approach for reducing the session memory footprint is to provide a shorter duration memory named “call memory” that is active for the duration of a “call” but automatically deallocated when the call terminates. A call is the period of time when the user is actively using the server, such as a transaction in a database server. Accordingly, those objects that do not need to live beyond the duration of the call are placed in the call memory rather than session memory. When the call is completed, objects in the call memory are deallocated and the call-duration memory is reclaimed for us. This approach has been implemented in Oracle Corporation's PL/SQL™ language, for instance, in which objects are explicitly declared as having the duration of a call or of a session. Memory management in such a language is straightforward because the objects are simply allocated in the memory that corresponds to their duration.
The JAVA™ programming language, however, defines the lifetime of many objects, especially system objects, to extend throughout the duration of a session and does not have the notion of a call or call memory. One approach is to allocate objects initially in call memory, and at the end of the call migrate the objects that are still alive into session memory. Some of these objects, however, are infrequently used and have been dynamically loaded from disk. These external objects consume session memory and reduce the user scalability of the database system.
Therefore, there is a need for improving the user scalability of a relational database system implementing a run-time environment for handling database applications. A need exists for reducing the session memory footprint consumed by infrequently used objects in a run-time environment. There also exists a need for resolving external references to objects without wasting session memory.